package Model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 @author Женя
 */

public class Agency {

    private static Agency instance;

    private List <Director> directorList = new ArrayList <Director>();
    private List <Client> clientList = new ArrayList<Client>();
    private List <Staff> staffList = new ArrayList <Staff>();
    private Double money;
    private Map <Props, Integer> propsMap = new HashMap<Props, Integer>();
    private Order order = new Order();

    private Agency() {
    }

    private Agency(List<Director> directorList, List<Client> clientList, List<Staff> staffList, Double money, Map<Props, Integer> propsMap, Order order) {
        this.directorList = directorList;
        this.clientList = clientList;
        this.staffList = staffList;
        this.money = money;
        this.propsMap = propsMap;
        this.order = order;
    }

    public synchronized static Agency getInstance(){
        if (instance == null){
            instance = new Agency();
        }
        return instance;
    }

    public List<Director> getDirectorList() {
        return directorList;
    }

    public void setDirectorList(List<Director> directorList) {
        this.directorList = directorList;
    }

    public List<Client> getClientList() {
        return clientList;
    }

    public void setClientList(List<Client> clientList) {
        this.clientList = clientList;
    }

    public List<Staff> getStaffList() {
        return staffList;
    }

    public void setStaffList(List<Staff> staffList) {
        this.staffList = staffList;
    }

    public Double getMoney() {
        return money;
    }

    public void setMoney(Double money) {
        this.money = money;
    }

    public Map<Props, Integer> getPropsMap() {
        return propsMap;
    }

    public void setPropsMap(Map<Props, Integer> propsMap) {
        this.propsMap = propsMap;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        throw new CloneNotSupportedException("You already have one Agency!");
    }

    @Override
    public String toString() {
        return "Agency{" +
                "directorList=" + directorList +
                ", clientList=" + clientList +
                ", staffList=" + staffList +
                ", money=" + money +
                ", propsMap=" + propsMap +
                ", order=" + order +
                '}';
    }
}
